package sevensoft.创建型模式.建造者模式;


import lombok.ToString;

@ToString
public class Phone {
    private String name;

    private String screen;

    private String memory;

    private Phone(){}

    private Phone(Builder builder){
        this.name=builder.name;
        this.screen=builder.screen;
        this.memory=builder.memory;

    }

    public static final class Builder{
        private String name;

        private String screen;

        private String memory;

        public Builder name(String name){
            this.name=name;
            return this;
        }

        public Builder screen(String screen){
            this.screen=screen;
            return this;
        }

        public Builder memory(String memory){
            this.memory=memory;
            return this;
        }

        public Phone builder(){
            return new Phone(this);
        }
    }
}
